<%@ page language="java" pageEncoding="UTF-8"%>
<%@page import="java.util.ArrayList"%>
<%@page import="com.shsh.safemanage.util.Util"%>
<%@page import="com.shsh.safemanage.dao.UserDao"%>
<%@page import="com.shsh.safemanage.dao.EquipmentDao"%>
<%@page import="com.shsh.safemanage.model.Equipment"%>
<%@page import="com.shsh.safemanage.model.Department1"%>
<%@page import="com.shsh.safemanage.dao.DepartmentDao"%>
<%@page import="com.shsh.safemanage.util.Constants"%>
<%@page import="com.shsh.safemanage.model.User"%>
<%@page import="com.shsh.safemanage.model.Problem"%>
<%@page import="java.util.List"%>
<%@page import="com.shsh.safemanage.dao.DaoCreator"%>
<%@page import="com.shsh.safemanage.dao.ProblemDao"%>

<%
{
ProblemDao theRelateProblemDao = DaoCreator.createProblemDao();
DepartmentDao theRelateDepartDao = DaoCreator.createDepartmentDao();
EquipmentDao theEquipDao = DaoCreator.createEquipmentDao();
UserDao theRelateUserDao = DaoCreator.createUserDao();

User theRelateUser = (User) session.getAttribute(Constants.SESSION_USER);

// List<Problem> problemList = theRelateProblemDao.getUserRelatedProblemList(theRelateUser);
List<Problem> problemList = new ArrayList<Problem>(0);
%>
<table width="100%" border="0" cellpadding="0" cellspacing="0" style="font-size:12px;">
	<tr>
		<td width="8"  class="appbg">&nbsp;</td>
		<td width="85" class="appbg"><img src="images/trace.gif"  style="vertical-align:middle;"/>查询结果</td>
		<td width="229" class="appbg">&nbsp;</td>
		<td width="58" class="appbg">&nbsp;</td>
		<td width="84" class="appbg">&nbsp;</td>
		<td width="74" class="appbg">&nbsp;</td>
		<td colspan="2" class="appbg">&nbsp;</td>
	</tr>
	<tr>
		<td>&nbsp;</td>
		<td colspan="8" height="40">查询到<font color="#FF0000"><%=problemList.size()%></font>条记录。</td>
	</tr>
	<tr>
		<td class="a_text2" width="20%" height="30" colspan="2">作业部（业务中心）</td>
		<td class="a_text2" width="20%">装置</td>
		<td width="20%" class="a_text2">问题标题</td>
		<td width="6%" class="a_text2" align="center">发现人</td>
		<td width="12%" class="a_text2" align="center">填报日期</td>
		<td width="12%" class="a_text2" align="center">回复日期</td>
		<td width="10%" class="a_text2" align="center">查看</td>
		<td width="17"></td>
	</tr>
	<%
		int row = 0;
		for (Problem problem : problemList) {
			row++;
			Integer problemType = problem.getProblemType();
			String targetPage = Problem.getTargetDetailedPageURL(problem, request.getContextPath());
	%>
	<tr>
		<td></td>
		<%
		Department1 theDepart1 = theRelateDepartDao.getDepartment1ByID(problem.getDepartment1ID());
		%>
		<td class="a_text3"
		style="border-bottom:1px #E3E3E3 dashed;border-right:1px #E3E3E3 dashed; <%=(row % 2 == 1)? "background: #F8F8FF":"background: #DCDCDC"%>"><%=theDepart1.getDepartmentName()%></td>
		<%
		Equipment theEquipment = theEquipDao.getEquipment(problem.getEquipmentID());
		%>
		<td class="a_text3" style="border-bottom:1px #E3E3E3 dashed;border-right:1px #E3E3E3 dashed; <%=(row % 2 == 1)? "background: #F8F8FF":"background: #DCDCDC"%>"><%=theEquipment.getEquipName()%></td>
		<%
		User theWriteUser = theRelateUserDao.getUserByID(problem.getWriteUserID());
		%>
		<td class="a_text3" 
			style="border-bottom:1px #E3E3E3 dashed;border-right:1px #E3E3E3 dashed; border-left:1px #E3E3E3 dashed; <%=(row % 2 == 1)? "background: #F8F8FF":"background: #DCDCDC"%>"
		><%=problem.getProblemTitle()%></td>
		<td align="center" class="a_text3" 
			style="border-bottom:1px #E3E3E3 dashed; border-right:1px #E3E3E3 dashed; <%=(row % 2 == 1)? "background: #F8F8FF":"background: #DCDCDC"%>"><%=theWriteUser.getName()%></td>
		<td align="center" class="a_text3" 
			style="border-bottom:1px #E3E3E3 dashed; border-right:1px #E3E3E3 dashed; <%=(row % 2 == 1)? "background: #F8F8FF":"background: #DCDCDC"%>">&nbsp;<%=Util.formatDate(problem.getWriteTime())%></td>
		<td align="center" class="a_text3" 
			style="border-bottom:1px #E3E3E3 dashed;border-right:1px #E3E3E3 dashed; <%=(row % 2 == 1)? "background: #F8F8FF":"background: #DCDCDC"%>">&nbsp;<%=Util.formatDate(problem.getCloseTime())%></td>
		<td align="center" class="a_text3" 
			style="border-bottom:1px #E3E3E3 dashed;border-right:1px #E3E3E3 dashed; <%=(row % 2 == 1)? "background: #F8F8FF":"background: #DCDCDC"%>">
			<%
			String theColor = "red";
			if (problem.getProcessStatus() == Constants.PROBLEM_STATUS_CLOSE) {
				theColor = "black";
			} else if (problem.getProcessStatus() == Constants.PROBLEM_STATUS_PROVED) {
				theColor = "blue";
			}
			%>
			<a style="color: <%=theColor%>" href="javascript:" 
				onclick="loadPageSection('<%=targetPage%>', 'mainContentDiv', {id:<%=problem.getId()%>, fromPage:'yiban'}, true)">详细内容</a>
		</td>
		<td width="17" ></td>
	</tr>
	<%
	}
	%>
</table>
<%
}
%>